﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage/MasterPage.master" AutoEventWireup="true"
    CodeFile="BookingList.aspx.cs" Inherits="BookingManage_BookingList" Title="Booking列表" culture="auto" meta:resourcekey="PageResource3" uiculture="auto" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script language="javascript" type="text/javascript">
    function selectAll()
    {
        var a = document.getElementsByTagName("input");
        var all = document.getElementById("alls");
        for (var i=0; i<a.length; i++)
        {
            if(all.checked)
            {
                if (a[i].type == "checkbox") 
                {
                    a[i].checked = true;
                }
            }
            else
            {
                if (a[i].type == "checkbox") 
                {
                    a[i].checked = false;
                }
            }
        }
    }
    function cancelAll()
    {
        var a = document.getElementsByTagName("input");
        for (var i=0; i<a.length; i++)
        {
            if (a[i].type == "checkbox") 
            {
                a[i].checked = false;
            }
        }
    }
</script>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    
    <div class="title"><asp:Label ID="lblPendingBooking" runat="server" 
            Text="已办Booking" meta:resourcekey="lblPendingBookingResource1"></asp:Label></div>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
        
        <div id="myDiv" runat="server" class="divBgCover">
    </div>
    <div id="divError" runat="server" class="blue divActiveWindow">
        <table width="100%" align="center">
            <tr>
                <td>
                    <div class="title">
                        <asp:Label ID="lblCTitle" runat="server" Text="选择运输队" meta:resourcekey="lblCTitleResource1"></asp:Label></div>
                    <table class="add_table" cellspacing="1" cellpadding="3" align="center">
                        <tr>
                            <td align="right">
                                <asp:Label ID="lblCContractor" runat="server" Text="运输队：" meta:resourcekey="lblCContractorResource1"></asp:Label>
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlCContractor" runat="server"></asp:DropDownList>
                            </td>     
                        </tr>
                        <tr><td colspan="2" align="center">
                            &nbsp;<asp:Label ForeColor="Red" ID="lblCError" runat="server" Visible="false" Text="请选择运输队" meta:resourcekey="lblCErrorResource1"></asp:Label>
                        </td></tr>
                        <tr>
                            <td align="center" colspan="2">
                                <asp:Button ID="btnCSubmit" runat="server" Text="提交" CssClass="btn" OnClick="btnCSubmit_Click" meta:resourcekey="btnCSubmitResource1"/>&nbsp;&nbsp;
                                <asp:Button ID="btnCClose" CssClass="btn" runat="server" Text="返回" OnClick="btnCClose_Click"
                                        meta:resourcekey="btnCCloseResource1" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
    
            <table class="add_table" cellspacing="1" cellpadding="3" style="width: 100%" align="center">
                <tr>
                    <td align="right" width="15%"><asp:Label ID="lblShipper" runat="server" Text="托运人：" 
                            meta:resourcekey="lblShipperResource1"></asp:Label></td>
                    <td>
                        <table width="100%">
                            <tr>
                                <td rowspan="6" align="center">
                                    <asp:ListBox ID="lstShipper" runat="server" Width="100px" 
                                        SelectionMode="Multiple" meta:resourcekey="lstShipperResource1" />
                                    <cc1:ListSearchExtender ID="ListSearchExtender2" runat="server" TargetControlID="lstShipper"
                                        PromptCssClass="ListSearchExtenderPrompt" Enabled="True">
                                    </cc1:ListSearchExtender>
                                </td>
                                <td style="height: 2px">
                                </td>
                                <td rowspan="6" align="left">
                                    <asp:ListBox ID="lstSelShipper" runat="server" Width="100px" 
                                        SelectionMode="Multiple" meta:resourcekey="lstSelShipperResource1">
                                    </asp:ListBox>
                                    <cc1:ListSearchExtender ID="ListSearchExtender4" runat="server" TargetControlID="lstSelShipper"
                                        PromptCssClass="ListSearchExtenderPrompt" Enabled="True">
                                    </cc1:ListSearchExtender>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Button ID="btnAddSShipper" runat="server" CssClass="btn" Text="添加" 
                                        onclick="btnAddSShipper_Click" meta:resourcekey="btnAddResource1" />
                                    <br />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Button ID="btnDeleteSShipper" runat="server" CssClass="btn" Text="刪除" 
                                        onclick="btnDeleteSShipper_Click" meta:resourcekey="btnDeleteResource1" />
                                    <br />
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td align="right" width="15%"><asp:Label ID="lblSFactory" runat="server" Text="工厂：" 
                            meta:resourcekey="lblSFactoryResource1"></asp:Label></td>
                    <td>
                        <table width="100%">
                            <tr>
                                <td rowspan="6" align="center">
                                    <asp:ListBox ID="lstFactory" runat="server" Width="100px" 
                                        SelectionMode="Multiple" meta:resourcekey="lstFactoryResource1" />
                                    <cc1:ListSearchExtender ID="ListSearchExtender1" runat="server" TargetControlID="lstFactory"
                                        PromptCssClass="ListSearchExtenderPrompt" Enabled="True">
                                    </cc1:ListSearchExtender>
                                </td>
                                <td style="height: 2px">
                                </td>
                                <td rowspan="6" align="left">
                                    <asp:ListBox ID="lstSelFactory" runat="server" Width="100px" 
                                        SelectionMode="Multiple" meta:resourcekey="lstSelFactoryResource1">
                                    </asp:ListBox>
                                    <cc1:ListSearchExtender ID="ListSearchExtender3" runat="server" TargetControlID="lstSelFactory"
                                        PromptCssClass="ListSearchExtenderPrompt" Enabled="True">
                                    </cc1:ListSearchExtender>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Button ID="btnAddSFactory" runat="server" CssClass="btn" Text="添加" 
                                        onclick="btnAddSFactory_Click" meta:resourcekey="btnAddSFactoryResource1" />
                                    <br />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Button ID="btnDeleteFactory" runat="server" CssClass="btn" Text="刪除" 
                                        onclick="btnDeleteFactory_Click" meta:resourcekey="btnDeleteFactoryResource1" />
                                    <br />
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td align="right" width="15%"><asp:Label ID="lblWhouse" runat="server" 
                            Text="仓库/码头：" meta:resourcekey="lblWhouseResource1"></asp:Label></td>
                    <td>
                        <asp:DropDownList ID="ddlWhouse" runat="server" 
                            meta:resourcekey="ddlWhouseResource1"></asp:DropDownList>
                    </td>
                    <td align="right" width="15%"><asp:Label ID="lblWinStart" runat="server" 
                            Text="开仓日期：" meta:resourcekey="lblWinStartResource1"></asp:Label></td>
                    <td>
                        <asp:TextBox ID="txtWinStart" runat="server" onkeydown="return pdDate(this, event);"
                            meta:resourcekey="txtWinStartResource1"></asp:TextBox>
                        <cc1:CalendarExtender ID="cbeWinStart" runat="server" TargetControlID="txtWinStart"
                                Format="yyyy-MM-dd" ></cc1:CalendarExtender>
                    </td>
                </tr>
                <tr>
                    <td align="right"><asp:Label ID="lblWinclose" runat="server" Text="截数日期：" 
                            meta:resourcekey="lblWincloseResource1"></asp:Label></td>
                    <td>
                        <asp:TextBox ID="txtWinClose" runat="server" onkeydown="return pdDate(this,event);"
                            meta:resourcekey="txtWinCloseResource1"></asp:TextBox>
                        <cc1:CalendarExtender ID="cbeWinClose" runat="server" TargetControlID="txtWinClose"
                                Format="yyyy-MM-dd" ></cc1:CalendarExtender>
                    </td>
                    <td align="right"><asp:Label ID="lblSJobDate" runat="server" Text="JobDate：" ></asp:Label></td>
                    <td>
                        <asp:TextBox ID="txtSJobDate" runat="server" onkeydown="return pdDate(this,event);"></asp:TextBox>
                        &nbsp;&nbsp;&nbsp;
                        <asp:Button ID="btnSearch" runat="server" Text="搜索" class="btn" 
                            OnClick="btnSearch_Click" meta:resourcekey="btnSearchResource1"/>
                    </td>
                </tr>
            </table>
            <div class="list_title">
             <div class="autoleft">
                <asp:Label ID="lblTotal" runat="server" meta:resourcekey="lblTotalResource1"></asp:Label> <asp:Label ID="lblRecordFound" runat="server" Text="条记录" meta:resourcekey="lblRecordFoundResource1"></asp:Label>
                &nbsp;&nbsp;JobDate:<asp:TextBox ID="txtNewJobDate" runat="server" width="110px" onkeydown="return pdDate(this,event);"></asp:TextBox>
                        <asp:TextBox ID="txtNewJobDateH" runat="server" Width="50px"></asp:TextBox>
                        <asp:Button ID="btnSave" runat="server" 
                            Text="保存" CssClass="btn" OnClick="btnSave_Click" 
                            meta:resourcekey="btnSaveResource1" />
                &nbsp;&nbsp;<asp:LinkButton ID="lbtnArrange" runat="server" Text="分配" OnClick="lbtnArrange_Click"
                                meta:resourcekey="lbtnArrangeResource1"></asp:LinkButton>
                &nbsp;&nbsp;<asp:LinkButton ID="lbtnCancelArrange" runat="server" Text="取消分配" OnClick="lbtnCancelArrange_Click"
                                meta:resourcekey="lbtnCancelArrangeResource1"></asp:LinkButton>
                &nbsp;&nbsp;<asp:LinkButton ID="lbtnCancelBooking" runat="server" Text="取消Booking" OnClick="lbtnCancelBooking_Click"
                                meta:resourcekey="btnCancelBookingResource1"></asp:LinkButton>
                </div>
                    <div class="autoright">                       
                        <asp:Label ID="lblPerPage" runat="server" Text="每页显示：" meta:resourcekey="lblPerPageResource1"></asp:Label>
                        <asp:DropDownList ID="ddlPages" runat="server" AutoPostBack="True" 
                            OnSelectedIndexChanged="ddlPages_SelectedIndexChanged" 
                            meta:resourcekey="ddlPagesResource1">
                            <asp:ListItem Text="10" Value="10" meta:resourcekey="ListItemResource1"></asp:ListItem>
                            <asp:ListItem Text="15" Value="15" meta:resourcekey="ListItemResource2"></asp:ListItem>
                            <asp:ListItem Selected="True" Text="20" Value="20" 
                                meta:resourcekey="ListItemResource3"></asp:ListItem>
                            <asp:ListItem Text="50" Value="50" meta:resourcekey="ListItemResource4"></asp:ListItem>
                            <asp:ListItem Text="100" Value="100" meta:resourcekey="ListItemResource5"></asp:ListItem>
                        </asp:DropDownList>
                    </div>
                     </div>
            <div style="overflow:auto; width:100%; height:400px; padding:1px;">
            <asp:GridView ID="gvBookedList" runat="server" AllowPaging="True" PageSize="20" AutoGenerateColumns="False"
                Width="100%" OnPageIndexChanging="gvBookedList_PageIndexChanging" OnRowCommand="gvBookedList_RowCommand"
                OnSorting="gvBookedList_Sorting" AllowSorting="True" 
                onrowdatabound="gvBookedList_RowDataBound" CssClass="tblGridView" 
                    meta:resourcekey="gvBookedListResource1">
                <PagerTemplate>
                    <table style="width: 100%">
                        <tr>
                            <td>
                               <asp:Label ID="lblPerPage" runat="server" Text="页次" meta:resourcekey="lblPerPageResource2"></asp:Label>&nbsp;<asp:Label 
                                    ID="Label1" runat="server" 
                                    Text='<%# ((GridView)Container.Parent.Parent).PageIndex+1 %>' 
                                    meta:resourcekey="Label1Resource1"></asp:Label>/<asp:Label
                                    ID="Label2" runat="server" 
                                    Text='<%# ((GridView)Container.Parent.Parent).PageCount %>' 
                                    meta:resourcekey="Label2Resource1"></asp:Label><asp:Label
                                                ID="lblPage" runat="server" Text="页" meta:resourcekey="lblPageResource1"></asp:Label>&nbsp;
                                <asp:Label ID="lblTotalPages" runat="server" Text="总计" meta:resourcekey="lblTotalPagesResource1"></asp:Label>&nbsp;<asp:Label 
                                    ID="Label3" runat="server" 
                                    Text="<%# ((System.Data.DataView)gvBookedList.DataSource).Count %>" 
                                    meta:resourcekey="Label3Resource1"></asp:Label>
                            </td>
                            <td align="right">
                                <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Page" CommandArgument="First"
                                    Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=0 %>" 
                                    Text="首页" meta:resourcekey="LinkButton1Resource1"></asp:LinkButton>
                                <asp:LinkButton ID="LinkButton2" runat="server" CommandArgument="Prev" CommandName="Page"
                                    Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=0 %>" 
                                    Text="前页" meta:resourcekey="LinkButton2Resource1"></asp:LinkButton>
                                <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Page" CommandArgument="Next"
                                    
                                    Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1 %>" 
                                    Text="后页" meta:resourcekey="LinkButton3Resource1"></asp:LinkButton>
                                <asp:LinkButton ID="LinkButton4" runat="server" CommandArgument="Last" CommandName="Page"
                                    
                                    Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1 %>" 
                                    Text="尾页" meta:resourcekey="LinkButton4Resource1"></asp:LinkButton>&nbsp;
                                <asp:Label ID="lblTurnOn" runat="server" Text="转第" 
                                    meta:resourcekey="lblTurnOnResource1"></asp:Label>
                                <asp:TextBox ID="txtPages" runat="server" Width="35px" 
                                    meta:resourcekey="txtPagesResource1"></asp:TextBox>
                                    <asp:Label ID="lblPages2" runat="server" Text="页" 
                                    meta:resourcekey="lblPages2Resource1"></asp:Label>
                                    <asp:LinkButton ID="lbtnGo" runat="server" Text="提交" onclick="lbtnGo_Click" 
                                    meta:resourcekey="lbtnGoResource1"></asp:LinkButton>
                            </td>
                        </tr>
                    </table>
                </PagerTemplate>
                <Columns>
                    <asp:TemplateField meta:resourcekey="TemplateFieldResource1">
                        <HeaderTemplate>
                            <input type="checkbox" id="alls" name="all" onclick="selectAll()" />
                        </HeaderTemplate>
                        <ItemTemplate>
                            <input type="checkbox" name="chkSelected" 
                                value='<%# DataBinder.Eval(Container.DataItem,"PKID") %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="View">
                        <ItemTemplate>
                            <a href='BookingDtl.aspx?id=<%# Eval("BID") %>&amp;rtn=-1'>Detail</a>
                        </ItemTemplate>
                        <ItemStyle Width="5%" />
                    </asp:TemplateField>
                       <asp:TemplateField HeaderText="序号" meta:resourcekey="TemplateFieldResource1">
                            <ItemTemplate>
                                <asp:Label ID="lblNo" runat="server" Text='<%# (Container as GridViewRow).RowIndex + 1 %>'
                                    meta:resourcekey="lblNoResource2"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    <asp:TemplateField HeaderText="托运人" SortExpression="Shipper" 
                        meta:resourcekey="TemplateFieldResource2">
                        <ItemTemplate>
                            <asp:Label ID="lblShipper" runat="server" Text='<%# Eval("Shipper") %>' 
                                meta:resourcekey="lblShipperResource2"></asp:Label>
                            <asp:Label ID="lblHKShipper" runat="server" Text='<%# Eval("HKShipper") %>' 
                                meta:resourcekey="lblShipperResource2"></asp:Label>
                            <asp:Label ID="lblENGShipper" runat="server" Text='<%# Eval("ENGShipper") %>' 
                                meta:resourcekey="lblShipperResource2"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="10%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="工厂" SortExpression="Vendor" 
                        meta:resourcekey="tfrVendorResource1">
                        <ItemTemplate>
                            <asp:Label ID="lblVendor" runat="server" Text='<%# Eval("Vendor") %>'></asp:Label>
                            <asp:Label ID="lblHKVendor" runat="server" Text='<%# Eval("HKVendor") %>'></asp:Label>
                            <asp:Label ID="lblENGVendor" runat="server" Text='<%# Eval("ENGVendor") %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="10%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="运输队" SortExpression="Contractor" 
                        meta:resourcekey="tfrContractorResource1">
                        <ItemTemplate>
                            <asp:Label ID="lblContractor" runat="server" Text='<%# Eval("CNContractor") %>'></asp:Label>
                            <asp:Label ID="lblHKContractor" runat="server" Text='<%# Eval("HKContractor") %>'></asp:Label>
                            <asp:Label ID="lblENGContractor" runat="server" Text='<%# Eval("ENGContractor") %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="10%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Appointment" SortExpression="Appointament">
                        <ItemTemplate>
                            <asp:Label ID="lblAppointament" runat="server" Text='<%# Eval("Appointament") %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="10%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="状态" SortExpression="Status" 
                        meta:resourcekey="tfrStatusResource1">
                        <ItemTemplate>
                            <asp:Label ID="lblStatus" runat="server" 
                                Text='<%# HK2009.Common.StringUtil.GetBookingNoteDtlStatusName(Eval("BNDtlStatus")) %>' 
                                meta:resourcekey="lblStatusResource2"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="5%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="SO_NO" SortExpression="SONO" 
                        meta:resourcekey="TemplateFieldResource3">
                        <ItemTemplate>
                            <asp:Label ID="lblSONO" runat="server" Text='<%# Eval("SONO") %>' 
                                meta:resourcekey="lblSONOResource1"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="10%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="JobDate" SortExpression="JobDate">
                        <ItemTemplate>
                            <asp:Label ID="lblJobDate" runat="server" 
                                Text='<%# Eval("JobDate", "{0:yyyy-MM-dd hh:mm:ss}") %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="5%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="WHSE/TML" SortExpression="Whouse" 
                        meta:resourcekey="TemplateFieldResource7">
                        <ItemTemplate>
                            <asp:Label ID="lblWhouse" runat="server" Text='<%# Eval("Whouse") %>' 
                                meta:resourcekey="lblWhouseResource2"></asp:Label>
                                <asp:Label ID="lblHKWhouse" runat="server" Text='<%# Eval("HKWhouse") %>' 
                                meta:resourcekey="lblWhouseResource2"></asp:Label>
                                <asp:Label ID="lblENGWhouse" runat="server" Text='<%# Eval("ENGWhouse") %>' 
                                meta:resourcekey="lblWhouseResource2"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="10%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Movement" SortExpression="FCLLCL" 
                        meta:resourcekey="TemplateFieldResource8">
                        <ItemTemplate>
                            <asp:Label ID="lblFCLLCL" runat="server" Text='<%# Eval("FCLLCL") %>' 
                                meta:resourcekey="lblFCLLCLResource1"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="10%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="ITEM" SortExpression="ItemNO" 
                        meta:resourcekey="TemplateFieldResource9">
                        <ItemTemplate>
                            <asp:Label ID="lblItemNO" runat="server" Text='<%# Eval("ItemNO") %>' 
                                meta:resourcekey="lblItemNOResource1"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="10%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="PCS" SortExpression="PCS" 
                        meta:resourcekey="TemplateFieldResource10">
                        <ItemTemplate>
                            <asp:Label ID="lblPCS" runat="server" Text='<%# Eval("PCS") %>' 
                                meta:resourcekey="lblPCSResource1"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="5%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="CTN" SortExpression="CTN" 
                        meta:resourcekey="TemplateFieldResource11">
                        <ItemTemplate>
                            <asp:Label ID="lblCTN" runat="server" Text='<%# Eval("CTN") %>' 
                                meta:resourcekey="lblCTNResource1"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="5%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="VOL" SortExpression="VOL" 
                        meta:resourcekey="TemplateFieldResource12">
                        <ItemTemplate>
                            <asp:Label ID="lblVOL" runat="server" Text='<%# Eval("VOL") %>' 
                                meta:resourcekey="lblVOLResource1"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="5%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Weight" SortExpression="GrossWT" 
                        meta:resourcekey="TemplateFieldResource13">
                        <ItemTemplate>
                            <asp:Label ID="lblGrossWT" runat="server" Text='<%# Eval("GrossWT") %>' 
                                meta:resourcekey="lblGrossWTResource1"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="5%" />
                    </asp:TemplateField>
                </Columns>
                <HeaderStyle HorizontalAlign="Center"/>
                <RowStyle HorizontalAlign="Center" />
            </asp:GridView>
            </div>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
</asp:Content>
